package com.gloaba.common.log.enums;
import org.apache.commons.lang3.StringUtils;


/**
 * 操作状态
 *
 * @author Zane Zhou
 */
public enum BusinessStatus
{
    /**
     * 成功
     */
    SUCCESS("SUCCESS", "成功"),

    /**
     * 失败
     */
    FAIL("FAIL", "失败");
    /**
     * 类型
     */
    private final String type;

    /**
     * 说明
     */
    private final String remark;

    BusinessStatus(String type, String remark) {
        this.type = type;
        this.remark = remark;
    }

    public String getType() {
        return type;
    }

    public String getRemark() {
        return remark;
    }

    public static BusinessStatus getValue(String type) {
        if (StringUtils.isEmpty(type)) {
            return null;
        }
        for (BusinessStatus c : BusinessStatus.values()) {
            if (c.type.toLowerCase().equals(type.toLowerCase())) {
                return c;
            }
        }
        return SUCCESS;
    }
}
